﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using NyARToolkitCSUtils.Capture;

namespace SimpleLiteForm
{
    static class Program
    {
        public static CaptureDevice capture_device;

        /// <summary>
        /// The programs main.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // get list of webcams
            CaptureDeviceList capture_device_list = new CaptureDeviceList();
            if (capture_device_list.count < 1)
            {
                MessageBox.Show("No Camera was detected.");
                return;
            }
            // asl user to select a webcam
            int cdevice_number = 0;
            using (CameraSelectDialog frm2 = new CameraSelectDialog())
            {
                frm2.ShowDialog(capture_device_list, out cdevice_number);
            }
            using (capture_device = capture_device_list[cdevice_number])
            {
                Application.Run(new Form1());
            }
        }
    }
}
